from flask import Flask
from flask_cors import CORS

from shop.model import feedback
from shop.views.wx1 import wx1, create_wx1_menu


def create_app():
    app = Flask(__name__)
    CORS(app, supports_credentials=True)
    app.jinja_env.variable_start_string = '{['
    app.jinja_env.variable_end_string = ']}'
    app.jinja_env.trim_blocks = True
    app.jinja_env.lstrip_blocks = True
    # 加载配置文件，包括sql等配置
    app.config.from_pyfile('conf.py')
    app.register_blueprint(wx1)
    # 创建微信菜单
    create_wx1_menu()
    return app
